﻿<navigation:Page x:Class="InsuranceAdjuster.Views.StatusBarView" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="900" d:DesignHeight="25"
                 Height="25" HorizontalAlignment="Stretch"
           DataContext="{Binding StatusBar, Source={StaticResource Locator}}" 
           Title="StatusBarView Page">
    <navigation:Page.Resources>
        <Style TargetType="TextBlock">
            <Setter Property="FontSize" Value="14"/>
        </Style>
        <Style x:Key="StatusBarLink" TargetType="HyperlinkButton">
            <Setter Property="Foreground" Value="{StaticResource MainTextColor}"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="Padding" Value="2,0,2,0"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="HorizontalContentAlignment" Value="Left"/>
            <Setter Property="VerticalContentAlignment" Value="Top"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="HyperlinkButton">
                        <Grid Background="{TemplateBinding Background}" Cursor="{TemplateBinding Cursor}">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="UnderlineTextBlock">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Pressed">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="UnderlineTextBlock">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="DisabledOverlay">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualState x:Name="Focused">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisualElement"/>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Unfocused"/>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Rectangle Margin="0" StrokeThickness="1" Fill="{StaticResource YellowBrush}"/>

                            <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Margin="0" d:LayoutOverrides="Height"/>

                            <Rectangle x:Name="DisabledOverlay" Margin="0" Opacity="0.5" StrokeThickness="1" Fill="#AAA" Visibility="Collapsed" />


                            <TextBlock x:Name="UnderlineTextBlock" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Text="{TemplateBinding Content}" TextDecorations="Underline" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                          
                            <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="false" Opacity="0" Stroke="#FF6DBDD1" StrokeThickness="1"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </navigation:Page.Resources>
    <Grid x:Name="LayoutRoot">
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom">
            <TextBlock Text="Network Connected: "/>
            <TextBlock Text="{Binding Path=EntityManager.IsOnline, Mode=OneWay}" />
            <TextBlock Text=" | " />
            <HyperlinkButton Command="{Binding ShowSyncDialogCommand}" Style="{StaticResource StatusBarLink}">
                <HyperlinkButton.Content>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Messages Pending: " />
                        <TextBlock Text="{Binding MessagesPending}" />
                    </StackPanel>
                </HyperlinkButton.Content>
            </HyperlinkButton>
            <TextBlock Text=" | " />
            <HyperlinkButton Command="{Binding ShowSyncDialogCommand}" Style="{StaticResource StatusBarLink}">
                <HyperlinkButton.Content>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Messages Syncing: " />
                        <TextBlock Text="{Binding MessagesInFlight}" />
                    </StackPanel>
                </HyperlinkButton.Content>
            </HyperlinkButton>
            <TextBlock Text=" | " />
          <StackPanel Orientation="Horizontal">
            <TextBlock Text="Items Queued: " />
            <TextBlock Text="{Binding EntitiesInQueue}" />
          </StackPanel>
            <TextBlock Text=" | " />
            <HyperlinkButton Command="{Binding SyncNowCommand}" Content="Sync Now"  IsEnabled="{Binding Path=EntityManager.IsOnline, Mode=OneWay}" FontSize="14"/>
        </StackPanel>
    </Grid>
</navigation:Page>
